Page({
  data: {
    indicatorDots: true,
    autoplay: true,
    interval: 1000,
    active: 0,
    show: false,
    src: '', // 照片存储路径
    actions: [{
        name: '拍照',
        method: 'takePhoto'
      },
      {
        name: '从手机相册选择',
        method: 'chooseFromGallery'
      },
      {
        name: '取消',
        method: 'cancel'
      },
    ],
  },

  onClose() {
    this.setData({
      show: false,
    });
  },

  onbutton() {
    this.setData({
      show: true,
    });
  },

  onSelect(event) {
    const {
      method
    } = event.detail;
    if (this[method]) {
      this[method]();
    } else {
      console.log('未知选项');
    }
  },

  takePhoto() {
    this.ctx.takePhoto({
      quality: 'high',
      success: (res) => {
        this.setData({
          src: res.tempImagePath
        })
      }
    })
  },

  chooseFromGallery() {
    wx.chooseImage({
      sourceType: ['album'],
      success(res) {
        const tempFilePaths = res.tempFilePaths;
        console.log('相册选择路径:', tempFilePaths);
        // 可以在这里处理照片，比如上传到服务器或者展示在页面上
      },
      fail(err) {
        console.error('选择相册失败:', err);
      },
    });
    this.onClose();
  },

  cancel() {
    this.onClose();
  },


  tswgk() {
    wx.navigateTo({
      url: '/pages/sanwuGK/sanwuGK',
    })
  },

  tzgjy() {
    wx.navigateTo({
      url: '/pages/hiring/hiring',
    })
  },

  tjyxx() {
    wx.navigateTo({
      url: '/pages/serve-jiaoyu/serve-jiaoyu',
    })
  },

  tsjsb() {
    wx.navigateTo({
      url: '/pages/sjsb/sjsb',
    })
  },

  tbsdt() {
    wx.navigateTo({
      url: '/pages/bsdt/bsdt',
    })
  },

  tzncs() {
    wx.navigateTo({
      url: '/pages/znsc/znsc',
    })
  },

  jmhd() {
    wx.navigateTo({
      url: '/pages/juMinsh/juMinsh',
    })
  },

  gdfu() {
    wx.navigateTo({
      url: '/pages/serve/serve',
    })
  },

  demo1() {
    wx.navigateTo({
      url: '/pages/hiring/hiring',
    })
  },
  onShow: function(){
    wx.hideHomeButton({
      complete:()=>{
        console.log(999)
      }
    })
  }
})